rectification of boundaries